package com.zhang.jedis;

import redis.clients.jedis.JedisCluster;

/**
 * @author zhangchenghui
 * @version 1.0.0
 * @ClassName MyJedis.java
 * @createTime 2021年09月04日 17:23:00
 * @Description
 */
public class MyJedis {
    public static void main(String[] args) {
        // 1. 建立连接
//        Jedis jedis = MyJedisPool.getResource();

        JedisCluster jedis = MyJedisCluster.getJedisCluster();
        // 2、操作

//        jedis.hset("person", "name","zhangsan");
//        jedis.hset("person", "sex","男");
//        jedis.hset("person", "age","19");

//        Map<String, String> person = jedis.hgetAll("person");

//        person.entrySet().forEach(System.out::println);
        String a = jedis.set("a", "aaa");
        String a1 = jedis.get("a");
        System.out.println(a); // ok

        System.out.println(a1); // aaa

        // 3、关闭连接
        jedis.close();
    }
}
